﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05StringSort
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = { "Hello,", "this", "is", "an", "array", "of", "strings", "that", "needs", "to", "be", "sorted", "." };
            for (int i = 0; i < array.Length - 1; i++)
            {
                for (int j = i + 1; j < array.Length; j++)
                {
                    if (array[i].Length > array[j].Length)
                    {
                        string temp = array[i];
                        array[i] = array[j];
                        array[j] = temp;
                    }
                }
            }
            foreach (var item in array)
            {
                Console.Write("{0} ", item);
            }
        }
    }
}
